package com.huangwenshuo.futurestarschoolmanagement.pojo.enums;

public enum  RequestStateEnum {
    SUCCESS(200, "请求成功"),
    FAILED(1001, "请求失败"),
    INVALID_PARAM(1002, "不合法的参数");



    private Integer value;
    private String display;

    public Integer value() {
        return this.value;
    }

    public String display() {
        return this.display;
    }

    private RequestStateEnum(Integer value, String display) {
        this.value = value;
        this.display = display;
    }

    public static String getDisplayByValue(Integer value) {
        RequestStateEnum booleanEnum = getEnumByValue(value);
        return booleanEnum != null ? booleanEnum.display() : null;
    }

    public static RequestStateEnum getEnumByValue(Integer value) {

        for (RequestStateEnum booleanEnum : values()) {
            if (booleanEnum.value().equals(value)) {
                return booleanEnum;
            }
        }
        return null;
    }
}
